3.671 \(\int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx\)

Optimal. Leaf size=54 \[ \frac {a (A-i B)}{c f (\tan (e+f x)+i)}+\frac {a B \log (\cos (e+f x))}{c f}+\frac {i a B x}{c} \]

[Out]

I*a*B*x/c+a*B*ln(cos(f*x+e))/c/f+a*(A-I*B)/c/f/(tan(f*x+e)+I)

________________________________________________________________________________________

Rubi [A]  time = 0.09, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3588, 43} \[ \frac {a (A-i B)}{c f (\tan (e+f x)+i)}+\frac {a B \log (\cos (e+f x))}{c f}+\frac {i a B x}{c} \]

Antiderivative was successfully verified.

[In]

Int[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]),x]

[Out]

(I*a*B*x)/c + (a*B*Log[Cos[e + f*x]])/(c*f) + (a*(A - I*B))/(c*f*(I + Tan[e + f*x]))

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx &=\frac {(a c) \operatorname {Subst}\left (\int \frac {A+B x}{(c-i c x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \operatorname {Subst}\left (\int \left (\frac {-A+i B}{c^2 (i+x)^2}-\frac {B}{c^2 (i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {i a B x}{c}+\frac {a B \log (\cos (e+f x))}{c f}+\frac {a (A-i B)}{c f (i+\tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 1.94, size = 123, normalized size = 2.28 \[ \frac {a (\sin (e+f x)-i \cos (e+f x)) \left (\cos (e+f x) \left (A+i B \log \left (\cos ^2(e+f x)\right )-4 B f x-i B\right )+\sin (e+f x) \left (i A+B \log \left (\cos ^2(e+f x)\right )+4 i B f x+B\right )+2 B \tan ^{-1}(\tan (2 e+f x)) (\cos (e+f x)-i \sin (e+f x))\right )}{2 c f} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]),x]

[Out]

(a*((-I)*Cos[e + f*x] + Sin[e + f*x])*(Cos[e + f*x]*(A - I*B - 4*B*f*x + I*B*Log[Cos[e + f*x]^2]) + 2*B*ArcTan
[Tan[2*e + f*x]]*(Cos[e + f*x] - I*Sin[e + f*x]) + (I*A + B + (4*I)*B*f*x + B*Log[Cos[e + f*x]^2])*Sin[e + f*x
]))/(2*c*f)

________________________________________________________________________________________

fricas [A]  time = 1.20, size = 43, normalized size = 0.80 \[ \frac {{\left (-i \, A - B\right )} a e^{\left (2 i \, f x + 2 i \, e\right )} + 2 \, B a \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{2 \, c f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*((-I*A - B)*a*e^(2*I*f*x + 2*I*e) + 2*B*a*log(e^(2*I*f*x + 2*I*e) + 1))/(c*f)

________________________________________________________________________________________

giac [B]  time = 0.91, size = 130, normalized size = 2.41 \[ \frac {\frac {B a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{c} - \frac {2 \, B a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c} + \frac {B a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{c} + \frac {3 \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 8 i \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 \, B a}{c {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{2}}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

(B*a*log(tan(1/2*f*x + 1/2*e) + 1)/c - 2*B*a*log(tan(1/2*f*x + 1/2*e) + I)/c + B*a*log(tan(1/2*f*x + 1/2*e) -
1)/c + (3*B*a*tan(1/2*f*x + 1/2*e)^2 - 2*A*a*tan(1/2*f*x + 1/2*e) + 8*I*B*a*tan(1/2*f*x + 1/2*e) - 3*B*a)/(c*(
tan(1/2*f*x + 1/2*e) + I)^2))/f

________________________________________________________________________________________

maple [A]  time = 0.25, size = 64, normalized size = 1.19 \[ -\frac {i a B}{f c \left (\tan \left (f x +e \right )+i\right )}+\frac {a A}{f c \left (\tan \left (f x +e \right )+i\right )}-\frac {a B \ln \left (\tan \left (f x +e \right )+i\right )}{f c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x)

[Out]

-I/f*a/c/(tan(f*x+e)+I)*B+1/f*a/c/(tan(f*x+e)+I)*A-1/f*a/c*B*ln(tan(f*x+e)+I)

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 8.57, size = 51, normalized size = 0.94 \[ \frac {\frac {A\,a}{c}-\frac {B\,a\,1{}\mathrm {i}}{c}}{f\,\left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )}-\frac {B\,a\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )}{c\,f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i))/(c - c*tan(e + f*x)*1i),x)

[Out]

((A*a)/c - (B*a*1i)/c)/(f*(tan(e + f*x) + 1i)) - (B*a*log(tan(e + f*x) + 1i))/(c*f)

________________________________________________________________________________________

sympy [A]  time = 0.38, size = 92, normalized size = 1.70 \[ \frac {B a \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c f} + \begin {cases} - \frac {\left (i A a e^{2 i e} + B a e^{2 i e}\right ) e^{2 i f x}}{2 c f} & \text {for}\: 2 c f \neq 0 \\- \frac {x \left (- A a e^{2 i e} + i B a e^{2 i e}\right )}{c} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x)

[Out]

B*a*log(exp(2*I*f*x) + exp(-2*I*e))/(c*f) + Piecewise((-(I*A*a*exp(2*I*e) + B*a*exp(2*I*e))*exp(2*I*f*x)/(2*c*
f), Ne(2*c*f, 0)), (-x*(-A*a*exp(2*I*e) + I*B*a*exp(2*I*e))/c, True))

________________________________________________________________________________________